package genericity.pecs;

import genericity.GTest;

import java.util.Arrays;
import java.util.List;

public class Test {

	static List<Apple> apples = Arrays.asList(new Apple());
	static List<Fruit> fruit = Arrays.asList(new Fruit());
	static void testReader() {
		
	    CovariantReader<Fruit> fruitReader = new CovariantReader<Fruit>();
	    Fruit f1= fruitReader.readCovariant(fruit);
	    Fruit f2 = fruitReader.read(fruit);
	    Fruit a1 = fruitReader.readCovariant(apples);
	    //Fruit a2 = fruitReader.read(apples); 不能读取子类
	    System.out.println("泛型读取：通过中间类告知编译器，泛型是存在继承关系的；应用：通过一个父类读取器能读取所有当前及子类的对象");
	    System.out.println(GTest.SPLIT);
	}
	
	
	public static void main(String[] args) {
		testReader();
	}
	
	
}
